package javaee.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAdvice {

    @Pointcut("execution(* javaee..*.*(..))") // 匹配javae
    private void myPointcut() {}

    @Before("myPointcut()")
    public void before(JoinPoint jp)  {
        //前置通知
        System.out.println(" LogAdvice before");
    }
    @AfterReturning("myPointcut()")
    public void after(JoinPoint jp) {
        //后置通知
        System.out.println(" LogAdvice after");
    }
}


